-
-
Notifications
You must be signed in to change notification settings - Fork 200
feat: Add attachment support to user feedback #1414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
|
Looks good at first glance, even though it feels like it's a lot of new API for a very specific use case. Since the goal is to add attachments to envelopes, I wonder if it would make sense to open up some of the existing but internal envelope APIs to make the same achievable in a more generic way. What do you think? |
To elaborate a bit, I'd propose wrapping/exposing the missing parts from sentry_value_t feedback = sentry_value_new_feedback(...);
sentry_envelope_t *envelope = sentry_envelope_new();
sentry_envelope_add_feedback(envelope, feedback);
sentry_envelope_attach_file(envelope, "screenshot.png");
sentry_capture_envelope(envelope); |
|
Exposing internal envelope APIs sounds like a reasonable alternative to me. However, if there are any concerns about doing so, the newly introduced hint type (perhaps with a more generic name like Also, the UPD: |
| SENTRY_WITH_OPTIONS (options) { | ||
| envelope = prepare_user_feedback(user_feedback); | ||
| envelope = prepare_user_feedback(user_feedback, hint); | ||
| if (envelope) { | ||
| sentry__capture_envelope(options->transport, envelope); | ||
| } else { | ||
| sentry_value_decref(user_feedback); | ||
| } | ||
| } | ||
|
|
||
| if (hint) { | ||
| sentry__feedback_hint_free(hint); | ||
| } | ||
| } |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If envelope was created successfully it takes ownership of the user_feedback value so we don't have to decref manually.
This PR adds the ability to attach files and binary data to feedback submissions allowing users to include screenshots, logs or other contextual information alongside their text messages.
The initial request to add attachment support for user feedback originated from the Unreal SDK:
Here, a hint pattern is used (borrowed from the Android SDK) which relies on an opaque pointer to provide a standardized way to attach optional context or metadata to feedback without modifying its core value.
Example usage:
Current implementation focuses on the feedback use case but it can be expanded to support additional APIs later on if needed.